package com.google.code.sip.ucenter.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.google.code.sip.core.dao.Page;
import com.google.code.sip.ucenter.dao.mongo.CreditRuleDaoImpl;
import com.google.code.sip.ucenter.model.CreditRule;
import com.google.code.sip.ucenter.service.CreditRuleManager;

/**
 * 积分规则管理类
 * 
 * @author fengcai Jun 25, 2010 11:23:54 AM
 */

@Service("creditRuleManager")
public class CreditRuleManagerImpl implements CreditRuleManager {

	@Autowired
	private CreditRuleDaoImpl creditRuleDao;

	@Override
	public Page<CreditRule> getAllCreditRules(Page<CreditRule> page) {
		return creditRuleDao.findByPage(page);
	}

	@Override
	public void saveCreditRule(CreditRule creditRule) {
		creditRuleDao.save(creditRule);
	}

	@Override
	public CreditRule getCreditRule(String id) {
		return creditRuleDao.get(id);
	}

	@Override
	public List<CreditRule> getAllCreditRule() {
		return creditRuleDao.findAll();
	}

	@Override
	public CreditRule getCreditRuleByAction(String action) {
		return creditRuleDao.getByAction(action);
	}

}
